package view.confirmaciones;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import model.Contacto;
import model.PersonalAdministrativo;
import view.eventos.CrearEvento;

public class ConfirmacionEvento extends JDialog {

	private static final long serialVersionUID = 1L;
	private final JPanel contentPanel = new JPanel();
	private int idAlumno = 0;
	private Contacto contacto;
	private PersonalAdministrativo personalAdministrativo;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			ConfirmacionEvento dialog = new ConfirmacionEvento(null);
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public ConfirmacionEvento(final PersonalAdministrativo personalAdministrativo) {
		this.personalAdministrativo = personalAdministrativo;
		setModal(true);
		setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
		setIconImage(Toolkit.getDefaultToolkit().getImage(ConfirmacionEvento.class.getResource("/Icon_/Good-mark.gif")));
		setAlwaysOnTop(true);
		setResizable(false);
		setBounds(100, 100, 404, 200);
		this.setLocationRelativeTo(null);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(null);

		JLabel lblLosEventosSirven = new JLabel("Los eventos sirven para poder mantenerse en contacto con los");
		lblLosEventosSirven.setFont(new Font("Tahoma", Font.PLAIN, 13));
		lblLosEventosSirven.setBounds(10, 11, 378, 14);
		contentPanel.add(lblLosEventosSirven);

		JLabel lblAcercarlesTodasLas = new JLabel("alumnos y poder acercarles todas las novedades respecto a sus");
		lblAcercarlesTodasLas.setFont(new Font("Tahoma", Font.PLAIN, 13));
		lblAcercarlesTodasLas.setBounds(10, 36, 378, 14);
		contentPanel.add(lblAcercarlesTodasLas);

		JLabel lbldeseaContinuarCon = new JLabel("\u00BFDesea finalizar el contacto sin generar un evento?");
		lbldeseaContinuarCon.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lbldeseaContinuarCon.setBounds(10, 95, 362, 20);
		contentPanel.add(lbldeseaContinuarCon);

		JLabel lblIntereses = new JLabel("intereses");
		lblIntereses.setFont(new Font("Tahoma", Font.PLAIN, 13));
		lblIntereses.setBounds(10, 61, 315, 14);
		contentPanel.add(lblIntereses);
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton okButton = new JButton("Si");
				okButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent arg0) {
						ContactoCreado ok = new ContactoCreado();
						dispose();
						ok.setVisible(true);
					}
				});
				okButton.setActionCommand("OK");
				buttonPane.add(okButton);
				getRootPane().setDefaultButton(okButton);
			}
			{
				JButton cancelButton = new JButton("No");
				cancelButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						CrearEvento evento = new CrearEvento(personalAdministrativo);
						evento.setId(idAlumno, contacto);
						dispose();
						evento.setVisible(true);
					}
				});
				cancelButton.setActionCommand("Cancel");
				buttonPane.add(cancelButton);
			}
		}
	}

	public void setId(int id, Contacto contacto) {
		idAlumno = id;
		this.contacto = contacto;
	}
}
